using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.ExpressApp.DC;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Xpo;
namespace Ascent.Module.BusinessObjects.Base
{
  [DefaultClassOptions]
  [DevExpress.Persistent.Base.NavigationItemAttribute("基础数据")]
  [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("产品")]
  public partial class Product : DevExpress.Persistent.BaseImpl.BaseObject
  {
    private Ascent.Module.BusinessObjects.Sales.SaleOrderDetail _saleOrderDetail;
    private DevExpress.Persistent.BaseImpl.FileData _attachment;
    private System.Int16 _quantity;
    private Ascent.Module.BusinessObjects.Purchase.PurchasingOrderDetail _purchasingOrderDetail;
    private System.String _isActive;
    private System.String _remarks;
    private System.String _retailPrice;
    private System.Single _preferentialPrice;
    private System.Single _lowestPrice;
    private System.Single _batchPrice;
    private System.String _maxStocks;
    private System.Int16 _safeStocks;
    private Ascent.Module.BusinessObjects.Base.Unit _unit;
    private Ascent.Module.BusinessObjects.Base.ProductCategory _productCategory;
    private System.String _productDescription;
    private System.String _productSpecification;
    private System.String _productAlias;
    private System.String _productName;
    private System.String _productCode;
    public Product(DevExpress.Xpo.Session session)
      : base(session)
    {
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("产品编码")]
    public System.String ProductCode
    {
      get
      {
        return _productCode;
      }
      set
      {
        SetPropertyValue("ProductCode", ref _productCode, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("产品名称")]
    public System.String ProductName
    {
      get
      {
        return _productName;
      }
      set
      {
        SetPropertyValue("ProductName", ref _productName, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("产品别名")]
    public System.String ProductAlias
    {
      get
      {
        return _productAlias;
      }
      set
      {
        SetPropertyValue("ProductAlias", ref _productAlias, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("产品规格")]
    public System.String ProductSpecification
    {
      get
      {
        return _productSpecification;
      }
      set
      {
        SetPropertyValue("ProductSpecification", ref _productSpecification, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("产品描述")]
    public System.String ProductDescription
    {
      get
      {
        return _productDescription;
      }
      set
      {
        SetPropertyValue("ProductDescription", ref _productDescription, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("产品类")]
    public Ascent.Module.BusinessObjects.Base.ProductCategory ProductCategory
    {
      get
      {
        return _productCategory;
      }
      set
      {
        if (_productCategory == value)
          return;
        Ascent.Module.BusinessObjects.Base.ProductCategory prevProductCategory = _productCategory;
        _productCategory = value;
        if (IsLoading)
          return;
        if (prevProductCategory != null && prevProductCategory.Product == this)
          prevProductCategory.Product = null;
        if (_productCategory != null)
          _productCategory.Product = this;
        OnChanged("ProductCategory");
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("单位")]
    public Ascent.Module.BusinessObjects.Base.Unit Unit
    {
      get
      {
        return _unit;
      }
      set
      {
        if (_unit == value)
          return;
        Ascent.Module.BusinessObjects.Base.Unit prevUnit = _unit;
        _unit = value;
        if (IsLoading)
          return;
        if (prevUnit != null && prevUnit.Product == this)
          prevUnit.Product = null;
        if (_unit != null)
          _unit.Product = this;
        OnChanged("Unit");
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("安全库存")]
    public System.Int16 SafeStocks
    {
      get
      {
        return _safeStocks;
      }
      set
      {
        SetPropertyValue("SafeStocks", ref _safeStocks, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("最高库存")]
    public System.String MaxStocks
    {
      get
      {
        return _maxStocks;
      }
      set
      {
        SetPropertyValue("MaxStocks", ref _maxStocks, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("批发价")]
    public System.Single BatchPrice
    {
      get
      {
        return _batchPrice;
      }
      set
      {
        SetPropertyValue("BatchPrice", ref _batchPrice, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("零售价")]
    public System.String RetailPrice
    {
      get
      {
        return _retailPrice;
      }
      set
      {
        SetPropertyValue("RetailPrice", ref _retailPrice, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("最低价")]
    public System.Single LowestPrice
    {
      get
      {
        return _lowestPrice;
      }
      set
      {
        SetPropertyValue("LowestPrice", ref _lowestPrice, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("优惠价")]
    public System.Single PreferentialPrice
    {
      get
      {
        return _preferentialPrice;
      }
      set
      {
        SetPropertyValue("PreferentialPrice", ref _preferentialPrice, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("库存数量")]
    public System.Int16 Quantity
    {
      get
      {
        return _quantity;
      }
      set
      {
        SetPropertyValue("Quantity", ref _quantity, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("备注")]
    public System.String Remarks
    {
      get
      {
        return _remarks;
      }
      set
      {
        SetPropertyValue("Remarks", ref _remarks, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("是否可用")]
    public System.String IsActive
    {
      get
      {
        return _isActive;
      }
      set
      {
        SetPropertyValue("IsActive", ref _isActive, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("附件")]
    [DevExpress.Xpo.AggregatedAttribute]
    [DevExpress.Persistent.Base.ExpandObjectMembersAttribute(ExpandObjectMembers.Never)]
    public DevExpress.Persistent.BaseImpl.FileData Attachment
    {
      get
      {
        return _attachment;
      }
      set
      {
        SetPropertyValue("Attachment", ref _attachment, value);
      }
    }
    [System.ComponentModel.BrowsableAttribute(false)]
    public Ascent.Module.BusinessObjects.Purchase.PurchasingOrderDetail PurchasingOrderDetail
    {
      get
      {
        return _purchasingOrderDetail;
      }
      set
      {
        if (_purchasingOrderDetail == value)
          return;
        Ascent.Module.BusinessObjects.Purchase.PurchasingOrderDetail prevPurchasingOrderDetail = _purchasingOrderDetail;
        _purchasingOrderDetail = value;
        if (IsLoading)
          return;
        if (prevPurchasingOrderDetail != null && prevPurchasingOrderDetail.Product == this)
          prevPurchasingOrderDetail.Product = null;
        if (_purchasingOrderDetail != null)
          _purchasingOrderDetail.Product = this;
        OnChanged("PurchasingOrderDetail");
      }
    }
    public Ascent.Module.BusinessObjects.Sales.SaleOrderDetail SaleOrderDetail
    {
      get
      {
        return _saleOrderDetail;
      }
      set
      {
        if (_saleOrderDetail == value)
          return;
        Ascent.Module.BusinessObjects.Sales.SaleOrderDetail prevSaleOrderDetail = _saleOrderDetail;
        _saleOrderDetail = value;
        if (IsLoading)
          return;
        if (prevSaleOrderDetail != null && prevSaleOrderDetail.Product == this)
          prevSaleOrderDetail.Product = null;
        if (_saleOrderDetail != null)
          _saleOrderDetail.Product = this;
        OnChanged("SaleOrderDetail");
      }
    }
  }
}
